<template>
  <div class="content-box">
    <nav-title title="招聘录用审批" :routerLink="routerLink" />
    <!-- 发起人基本信息 -->
    <div class="regulations-box">
      <div class="title">发起人基本信息</div>
      <v-base-info v-bind:baseInfo="allInfo"></v-base-info>
    </div>
    <!-- 员工履历 -->
    <div class="regulations-box">
      <div class="title">员工履历</div>
      <simple-line title="姓名" v-bind:value="allInfo.name" />
      <simple-line title="性别" v-bind:value="allInfo.sexValue" />
      <simple-line title="年龄" v-bind:value="allInfo.cAge+''" />
      <simple-line title="家庭地址" v-bind:value="allInfo.addresslong" />
      <simple-line title="毕业院校" v-bind:value="allInfo.cSchool" />
      <simple-line title="学历" v-bind:value="allInfo.cEducitonValue" />
      <simple-line title="专业" v-bind:value="allInfo.cMajor" />
      <simple-line title="毕业时间" v-bind:value="allInfo.cGraduationTime" />
      <simple-line title="目前公司" v-bind:value="allInfo.cCurCom" />
      <simple-line title="任职岗位" v-bind:value="allInfo.cCurPost" />
      <simple-line title="目前年总收入税前" v-bind:value="allInfo.cCurAnnSal+' 万元'" />
    </div>
    <!-- 招聘来源 -->
    <div class="regulations-box">
      <div class="title">招聘来源</div>
      <simple-line title="招聘来源" v-bind:value="allInfo.cInrecruitmentValue" />
      <div v-if="allInfo.cInrecruitmentValue=='员工推荐'">
        <simple-line title="员工工号" v-bind:value="allInfo.emplid2+' '+allInfo.tempCName" />
        <simple-line title="职等" v-bind:value="allInfo.cLevel" />
      </div>
    </div>
    <!-- 评估结果 -->
    <div class="regulations-box">
      <div class="title">评估结果</div>
      <simple-line title="公司" v-bind:value="allInfo.cDrftBusUnit" />
      <simple-line title="部门全称" v-bind:value="allInfo.detpDescr" />
      <simple-line title="岗位" v-bind:value="allInfo.jobcodeDescr" />
      <simple-line title="职等" v-bind:value="allInfo.cJobType + allInfo.rsJobLevel+''" />
      <simple-line title="PPT面试" v-bind:value="allInfo.cPptInterRsltValue" />
      <simple-line title="考核结果" v-bind:value="allInfo.cPerformResultValue" />
      <simple-line title="二次入司" v-bind:value="allInfo.cYn4Value" />
      <simple-line title="入职日期" v-bind:value="allInfo.hireDt" />
      <simple-line title="管委会" v-bind:value="allInfo.cGwhValue" />
      <simple-line
        v-if="allInfo.cDrftBusUnit=='医疗集团'"
        title="明州医院"
        v-bind:value="allInfo.cMzyyValue"
      />
    </div>
    <!-- 薪酬待遇 -->
    <div class="regulations-box">
      <div class="title">薪酬待遇</div>
      <simple-line title="年总收入" v-bind:value="'税前'+allInfo.cAnnSal+'万元'" />
      <simple-line
        title="发放方式"
        v-bind:value="allInfo.cPayPostTypeValue+' 12 + '+allInfo.cMonth+'个月'"
      />
      <simple-line title="固定年收入" v-bind:value="'税前'+allInfo.cPayAnnualSal+'万元'" />
      <simple-line title="试用期固薪税前" v-bind:value="allInfo.cPeriodWage+'元/月'" />
      <simple-line title="转正固薪税前" v-bind:value="allInfo.cPayMonavgSal+'元/月'" />
      <simple-line title="年终奖基数税前" v-bind:value="allInfo.cYearPayBase+'元/年'" />
      <simple-line
        v-if="allInfo.cAllowanceFalgValue == '无'"
        title="岗位津贴"
        v-bind:value="allInfo.cAllowanceFalgValue"
      />
      <simple-line
        v-else
        title="岗位津贴"
        v-bind:value="allInfo.cAllowanceFalgValue+' 税前'+allInfo.cAllowance+'元/月'"
      />

      <simple-line
        v-if="allInfo.cIncentiveFalgValue == '无'"
        title="激励/绩效"
        v-bind:value="allInfo.cIncentiveFalgValue"
      />
      <simple-line
        v-else
        title="激励/绩效"
        v-bind:value="allInfo.cIncentiveFalgValue+' 税前'+allInfo.cIncentive+'元/月'"
      />

      <simple-line
        v-if="allInfo.cGuaPerFalgValue == '无'"
        title="保底期限"
        v-bind:value="allInfo.cGuaPerFalgValue"
      />
      <simple-line
        v-else
        title="保底期限"
        v-bind:value="allInfo.cGuaPerFalgValue + ' ' + allInfo.cGuaPer + '年'"
      />

      <simple-line
        v-if="allInfo.cPerBonFalgValue == '无'"
        title="业绩奖基数"
        v-bind:value="allInfo.cPerBonFalgValue"
      />
      <simple-line
        v-else
        title="业绩奖基数"
        v-bind:value="allInfo.cPerBonFalgValue + ' 税前' + allInfo.cPerBonBase + '元/月'"
      />

      <simple-line title="备注" v-bind:value="allInfo.cSpecial" />
      <simple-line title="特殊约定" v-bind:value="allInfo.cOtherExplain" />
      <file-line label="附件" :important="true" :fileitems="allInfo.wfFiles" :boldtitle="true" />
    </div>

    <div class="regulations-box">
      <div class="title">分权引用</div>
      <fqyy-line
        :editting="false"
        :fqyyFlag="fqyyInfo.cFqyyFlag"
        :noFqyySum="fqyyInfo.noFqyySum"
        :noFqyyRatio="fqyyInfo.noFqyyRatio"
        :fqyyMsg="fqyyInfo.cFqyyDetail"
        ref="fqyy"
      ></fqyy-line>
    </div>

    <!-- 应聘者信息 -->
    <!-- <div class="regulations-box">
      <div class="title">应聘者信息</div>
      <simple-line title="应聘者ID" v-bind:value="allInfo.rsHireId"/>
      <simple-line title="应聘者姓名" v-bind:value="allInfo.name"/>
      <simple-line title="是否黑名单" v-bind:value="allInfo.cBlacklistFlagValue"/>
      <simple-line title="是否二次入司" v-bind:value="allInfo.cYn4Value"/>
      <simple-line title="签署竞业协议" v-bind:value="allInfo.cRestricJobFlagValue"/>
      <simple-line title="发生过离职补偿" v-bind:value="allInfo.cResignComFlagValue"/>
      <simple-line title="发生劳动仲裁" v-bind:value="allInfo.cLaborAtriFlagValue"/>
      <simple-line title="性别" v-bind:value="allInfo.sexValue"/>
      <simple-line title="年龄" v-bind:value="allInfo.cAge"/>
      <simple-line title="学历" v-bind:value="allInfo.cEducitonValue"/>
      <simple-line title="手机号码" v-bind:value="allInfo.phone"/>
      <simple-line title="家庭地址" v-bind:value="allInfo.addresslong"/>
      <simple-line title="毕业院校" v-bind:value="allInfo.cSchool"/>
      <simple-line title="专业" v-bind:value="allInfo.cMajor"/>
      <simple-line title="考评结果" v-bind:value="allInfo.cPerformResultValue" v-if="displayVal['cPerformResult']"/>
      <simple-line title="试用期（月）" v-bind:value="allInfo.cIntershipTerm"/>
      <simple-line title="拟录用部门" v-bind:value="allInfo.detpDescr"/>
      <simple-line title="拟录用岗位" v-bind:value="allInfo.jobcodeDescr"/>
      <simple-line title="拟入职职等" v-bind:value="allInfo.rsJobLevel"/>
      <simple-line title="实有人数/部门编制" v-bind:value="allInfo.cDeptHcRate"/>
      <simple-line title="拟入职日期" v-bind:value="allInfo.hireDt"/>
      <simple-line title="薪资带宽" v-bind:value="allInfo.cPayRange" v-if="displayVal['cPayRange']" />
      <simple-line title="薪资组" v-bind:value="allInfo.gpPaygroupValue" v-if="displayVal['gpPaygroup']" />
      <simple-line title="定薪级别" v-bind:value="allInfo.cPayType" v-if="displayVal['cPayType']" />
      <simple-line title="年薪（元）" v-bind:value="allInfo.cPayAnnualSal"
      v-if="allInfo.cPayType=='D'"
       />
      <simple-line title="审批工资（元）"
        v-if="allInfo.cPayType=='A' || allInfo.cPayType=='B' || allInfo.cPayType=='C'"
        v-bind:value="allInfo.cPayAplSal"/>
      <simple-line title="日薪（元）" v-if="allInfo.cPayType=='E'" v-bind:value="allInfo.cPayDailySal"/>
      <simple-line title="日薪（元）" v-if="allInfo.cPayType=='F'" v-bind:value="allInfo.cPayHourSal"/>
      <edit-option-line label="浮动部分按比例拆分"  v-if="displayVal['cFloatSplitFlg']"  :editting="editVal['cFloatSplitFlg']" :vals="ynVal" :showValue="allInfo.cFloatSplitFlgValue" :boldtitle="true" v-model="allInfo.cFloatSplitFlg"/>
      <simple-line title="月平均工资（元）" v-bind:value="allInfo.cPayMonavgSal"
      v-if="allInfo.cPayType=='H'"
      />
      <simple-line title="固定比例（%）" v-bind:value="allInfo.cPayFixedPct"
      v-if="allInfo.cPayType=='D'"
       />
      <simple-line title="浮动比例（%）" v-bind:value="allInfo.cPayFloatPct"
      v-if="allInfo.cPayType=='D'"
       />
      <simple-line title="月度比例（%）" v-bind:value="allInfo.cPayMnPct"
      v-if="allInfo.cPayType=='D' && allInfo.cFloatSplitFlg == 'Y'"
       />
      <simple-line title="季度比例（%）" v-bind:value="allInfo.cPayQutPct"
      v-if="allInfo.cPayType=='D' && allInfo.cFloatSplitFlg == 'Y'"
       />
      <simple-line title="年度比例（%）" v-bind:value="allInfo.cPayYearPct"
      v-if="allInfo.cPayType=='D' && allInfo.cFloatSplitFlg == 'Y'"
       />

      <simple-line title="社保缴纳地" v-bind:value="allInfo.rsSilCdValue"/>
      <simple-line title="社保缴纳基数" v-bind:value="allInfo.cSbPayBase" v-if="displayVal['cSbPayBase']"/>
      <simple-line title="年终奖基数" v-bind:value="allInfo.cPayBonusNum"
      v-if="allInfo.cPayType=='B'"
      />
      <simple-line title="缴纳五险" v-bind:value="allInfo.cWxFlagValue"/>
      <simple-line title="缴纳一金" v-bind:value="allInfo.cGjjFlagValue"/>
      <simple-line title="其它说明" v-bind:value="allInfo.cOtherExplain"/>
      <file-line label="附件" :important="true" :fileitems="allInfo.wfFiles" :boldtitle="true"/>
    </div>-->

    <!-- 流程图 -->
    <div class="regulations-box">
      <div class="title">流程图</div>
      <v-flow-charts :transNum="cTransactionNbr"></v-flow-charts>
    </div>
    <!-- 审批意见 -->
    <div class="regulations-box" v-if="approved == '0'&&allInfo.cStepType!='C'">
      <div class="info-label">审批意见</div>
      <div class="info-label-text">
        <textarea v-if="approved == '0'" placeholder="请在这里输入..." rows="5" v-model="cComments"></textarea>
        <textarea v-else readonly rows="5" v-model="cComments"></textarea>
      </div>
    </div>
    <!--  <fqyy-line v-bind:authorityFalg="allInfo.authorityFalg" v-bind:authoritySum="allInfo.authoritySum" v-bind:authorityRatio="allInfo.authorityRatio" v-bind:authorityDetail="allInfo.authorityDetail"></fqyy-line>11 -->

    <div style="height: 50px"></div>
    <!-- 底部按钮 -->
    <div v-if="approved == '0'">
      <operation-btn
        :cApprovalSw="allInfo.cApprovalSw"
        :cDenySw="allInfo.cDenySw"
        :cPushbackAllSw="allInfo.cPushbackAllSw"
        :cAddSw="allInfo.cAddSw"
        :cTransactionNbr="allInfo.cTransactionNbr"
        :cWfType="allInfo.cWfType"
        :cReadSw="allInfo.cIsChuanyue"
        :cStepType="allInfo.cStepType"
        :cComments="cComments"
        :approveBizType="'recruitment'"
        :getBizParams="getBizParams"
      ></operation-btn>
      <!--  -->
    </div>
  </div>
</template>
<script>
  import { dateFormat } from "vux";
import fqyyLine from "../../components/basic/FqyyLine"
import vBaseInfo from "../formalStaff/baseInfo";
import SimpleLine from '../../components/basic/SimpleLine'
import FileLine from '../../components/basic/FileLine'
import CommonUtil from '../../components/basic/util'
import { getRecruitmentInfo, getRecruitmentApproveDrft,getFqyyInfo } from "../../api/api";
import operationBtn from "./common/operationBtn";
import vFlowCharts from "../formalStaff/common/flowChart";
import { json2Form } from "../../util/http";

export default {
  components: {
    operationBtn,
    dateFormat,
    vFlowCharts,
    SimpleLine,
    vBaseInfo,
    FileLine,
    fqyyLine
  },

  created() {
	  CommonUtil.tryLogin(this).then(()=>{
        this.cTransactionNbr = this.$route.query.cTransactionNbr;
        this.approved = this.$route.query.approved;
        this.loginOprid = this.$route.query.token;
        if (this.$route.query.approved == "1") {
          this.routerLink = "/todoList/done";
        } else {
          this.routerLink = "/todoList/todo";
        }
        this.getData();
    })
  },
  mounted() {},
  data() {
    return {
      fqyyInfo:{
        fqyyFlag:'',
        fqyyDetail:''
      },
      ynVal:[{ value: "是", key: "Y" }, { value: "否", key: "N" }],

      approved: '0',
      routerLink: "/todoList/todo",
      allInfo: {},
      cComments: "",
      displayVal: {},
      editVal: {},
      cTransactionNbr: this.$route.query.cTransactionNbr

    };
  },
  methods: {
    getData() {
      this.$vux.loading.show();
      getRecruitmentInfo({
        cTransactionNbr: this.cTransactionNbr,
        loginOprid: this.loginOprid
      })
        .then(res => {
          this.$vux.loading.hide();

          if (res && res.retCode === "000000") {

            CommonUtil.updateFileUrl(res.retData.wfFiles);
            CommonUtil.fillNumberEmpty(res.retData,
              ["cPayAnnualSal", "cPayAplSal", "cPayDailySal", "cPayBonusNum", "age", "cIntershipTerm", "cMonthPayStd", "cPayFixedPct", "cPayFloatPct", "cSbPayBase"]
            );
            CommonUtil.fillYNShow(res.retData,
              ["cLaborAtriFlag", "cResignComFlag", "cRestricJobFlag", "cYn4", "cFloatSplitFlg", "cWxFlag", "cGjjFlag", "cBlacklistFlag"]
            )

            let auths = res.retData.authFileds;
            for(var i=0;i<auths.length;i++) {
              this.displayVal[auths[i].fieldKey] = auths[i].isDisplay
              this.editVal[auths[i].fieldKey] = auths[i].isEdit
            }
            this.allInfo = res.retData;
            this.allInfo.cWklifBgnDt2 = dateFormat(new Date(res.retData.cWklifBgnDt2), "YYYY/MM/DD");
            this.allInfo.birthdate = dateFormat(new Date(res.retData.birthdate), "YYYY/MM/DD");
            this.allInfo.hireDt = dateFormat(new Date(res.retData.hireDt), "YYYY/MM/DD");
            this.allInfo.cWklifBgnDt2 = dateFormat(new Date(res.retData.cWklifBgnDt2), "YYYY/MM/DD");
            this.allInfo.cWfAppDt = dateFormat(res.retData.cWfAppDt, "YYYY/MM/DD");
            getFqyyInfo({'cTransactionNbr':this.cTransactionNbr,'processType':'employment'}).then(res => {
                this.fqyyInfo = res.retData;
            })
          } else {
            this.$vux.alert.show({
              title: "提示",
              content: res.retMsg
            });
          }
        })
        .catch(res => {
          this.$vux.loading.hide();
          this.$vux.alert.show({
            title: "警告",
            content: "网络异常，请稍后重试"
          });
        });
    },
    getBizParams(){
      var _this = this;
      var params = {};
      Object.keys(_this.editVal).forEach(function(key){
        if(key && _this.editVal[key]) {
          params[key] = _this.allInfo[key]
        }
      });
      return params;
    }
  }
};
</script>

<style type="text/scss" lang="scss">
@import "../../styles/staff.scss";
@import "../../styles/rejectmain.scss";
</style>
